home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / extcompose < prev    next >
Encoding:
Text File  |  1995-07-03  |  3.9 KB  |  127 lines

  1. :
  2. # This file Copyright (c) 1992 Z-Code Software Corp.
  3. # Permission to use, copy, modify, and distribute this material
  4. # for any purpose and without fee is hereby granted, provided
  5. # that the above copyright notice and this permission notice
  6. # appear in all copies, and that the name of Z-Code Software not
  7. # be used in advertising or publicity pertaining to this
  8. # material without the specific, prior written permission
  9. # of an authorized representative of Z-Code.  Z-CODE SOFTWARE
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13. if [ $# -lt 1 ]
  14. then
  15.     echo "Usage:  $0 output-file-name" 1>&2
  16.     exit 1
  17. fi
  18. OUTFNAME=$1
  19.  
  20. choosing=yes
  21. while [ $choosing = yes ]
  22. do
  23.     echo ""
  24.     echo "Where is the external data that you want this mail message to reference?"
  25.     echo "    1 -- In a local file"
  26.     echo "    2 -- In an AFS file"
  27.     echo "    3 -- In an anonymous FTP directory on the Internet"
  28.     echo "    4 -- In an Internet FTP directory that requires a valid login"
  29.     echo "    5 -- Under the control of a mail server that will send the data on request"
  30.     echo ""
  31.     echo-n "Please enter a number from 1 to 5: \c"
  32.     read ans
  33.     case "$ans" in
  34.         1) accesstype=local-file ;;
  35.     2) accesstype=afs ;;
  36.     3) accesstype=anon-ftp ;;
  37.     4) accesstype=ftp ;;
  38.     5) accesstype=mail-server ;;
  39.     * ) echo "That is NOT one of your choices." 1>&2; continue ;;
  40.     esac
  41.  
  42.     case "$accesstype" in
  43.         ftp | anon-ftp )
  44.         echo-n "Enter the full Internet domain name of the FTP site: "
  45.         read site
  46.         echo-n "Enter the name of the directory containing the file (RETURN for top-level): "
  47.         read directory
  48.         echo-n "Enter the name of the file itself: "
  49.         read name
  50.         echo-n "Enter the transfer mode (type 'image' for binary data, RETURN otherwise): "
  51.         read mode
  52.         if [ -n "$mode" ]
  53.         then mode=ascii
  54.         fi
  55.         echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > $OUTFNAME
  56.         echo-n "    site="\"$site\" >> $OUTFNAME
  57.         if [ -n "$directory" ]
  58.         then echo-n "; directory="\"$directory\">> $OUTFNAME
  59.         fi
  60.         echo-n "; mode="\"$mode\">> $OUTFNAME
  61.         echo "">> $OUTFNAME
  62.         choosing=no
  63.         ;;
  64.  
  65.     local-file | afs )
  66.         name=
  67.         while [ -z "$name" ]
  68.         do
  69.             echo-n "Enter the full path name for the file: "
  70.         read name
  71.         if [ ! -f "$name" ]
  72.         then
  73.             echo "The file $name does not seem to exist."
  74.             name=
  75.         fi
  76.         done
  77.         echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> $OUTFNAME
  78.         choosing=no
  79.         ;;
  80.     
  81.     mail-server )
  82.         echo-n "Enter the full email address for the mailserver: "
  83.         read server
  84.         echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> $OUTFNAME
  85.         choosing=no
  86.         ;;
  87.     
  88.     * )
  89.         echo accesstype $accesstype not yet implemented
  90.         ;;
  91.     esac
  92. done
  93.  
  94. echo-n "Please enter the MIME content-type for the externally referenced data: "
  95. read ctype
  96.  
  97. choosing=yes
  98. while [ $choosing = yes ]
  99. do
  100.     echo "Is this data already encoded for email transport?"
  101.     echo "  1 -- No, it is not encoded"
  102.     echo "  2 -- Yes, it is encoded in base64"
  103.     echo "  3 -- Yes, it is encoded in quoted-printable"
  104.     echo "  4 -- Yes, it is encoded using uuencode"
  105.     read encode
  106.     case "$encode" in
  107.     1 ) cenc="" choosing=no ;;
  108.     2 ) cenc="base64" choosing=no ;;
  109.     3 ) cenc="quoted-printable" choosing=no ;;
  110.     4 ) cenc="x-uue" choosing=no ;;
  111.     * ) echo "That is not one of your choices." ;;
  112.     esac
  113. done
  114.  
  115. echo "" >> $OUTFNAME
  116. echo "Content-type: " $ctype >> $OUTFNAME
  117. if [ -n "$cenc" ]
  118. then echo "Content-transfer-encoding: " $cenc >> $OUTFNAME
  119. fi
  120. echo "" >> $OUTFNAME
  121. if [ "$accesstype" = "mail-server" ]
  122. then
  123.     echo "Please enter all the data to be sent to the mailserver in the message body, "
  124.     echo "ending with ^D or your usual end-of-data character:"
  125.     cat >> $OUTFNAME
  126. fi
  127.